<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>全屏图片页</title>
    <meta content="1280*720" name="page-view-size" http-equiv="">
    <link rel="stylesheet" href="../css/pics.css">
</head>
<body>
    <img src="" class="img">
    <img src="../images/imgText/imgLf.png" class="lf">
    <img src="../images/imgText/imgRt.png" class="rt">
    <p class='page'><span>1</span>/1</p>

    <script type="text/javascript">
        var clickFunction = function(keyEvent){
            keyEvent = keyEvent ? keyEvent : window.event;
            keyEvent.which = keyEvent.which ? keyEvent.which : keyEvent.keyCode;
            keycontrol(keyEvent);
        };
        //window.document.onkeypress = clickFunction;
        window.document.onkeydown = clickFunction;
        //按键操作
        function keycontrol(obj) {
            if (obj.which == 0x0026) {
                /* 上 */
            } else if (obj.which == 0x0028) {
                /* 下 */
            } else if (obj.which == 0x0025) {
                /* 左 */
                setPage(0);
            } else if (obj.which == 0x0027) {
                /* 右 */
                setPage(1);
            } else if (obj.which == 0x000D) {
                /* 确定 */
            } else if (obj.which == 113 || obj.which == 0x0008) {// 返回
    //          obj.stopPropagation();
    //          obj.preventDefault();
                history.go(-1);
            }
        }

        var imgArr=window.localStorage.getItem('portalWyImgArr').split(',');
        var page=0;
        var pageMax=imgArr.length;
        $('.img').src=imgArr[page];
        $('.page').innerHTML='<span>'+(page+1)+'</span>/'+pageMax;

        function setPage(num){//翻页，num为0表示上一页，num为1表示是下一页
            if(num==0&&page!=0){
                page--;
                $('.img').src=imgArr[page];
            }else if(num==1&&page<pageMax-1){
                page++;
                $('.img').src=imgArr[page];
            }
            $('.page>span').innerHTML=(page+1);
        }

        //搜索
        function $(select){
            return document.querySelector(select);
        }

        //截取传值参数
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i");
            var r = window.location.search.substr(1).match(reg);
            if (r!=null) return (r[2]); return null;
        }
    </script>
</body>
</html>